<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

//首页控制器
class IndexController extends Controller{
	private $model;
	//构造函数
	public function __init(){
		$this->model=new \Common\Model\Cate;
	}
	
    //动作
    public function index(){
		$topCate=$this->model->where('pid=0')->get();
		View::with('topCate',$topCate);
		$Cate=$this->model->get();
		$cateTwo = $this->model->where("pid=0")->get();
		foreach ($cateTwo as $k => $v) {
			$cateData[$k]['son'] = $this->model->where("pid={$v['cid']}")->limit(1)->get();

		}
		$this->assign('cateData',$cateData);
		View::with('Cate',$Cate);
		View::make();
    }
}
